home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / QuickdrawText.h < prev    next >
Text File  |  1995-07-06  |  8KB  |  214 lines

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    QuickDraw Text Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __QUICKDRAWTEXT__
  21. #define __QUICKDRAWTEXT__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __MIXEDMODE__
  30. #include <MixedMode.h>
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_ALIGN_SUPPORTED
  38. #pragma options align=mac68k
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45.  
  46. enum {
  47. /* CharToPixel directions */
  48.     leftCaret                    = 0,                            /*Place caret for left block*/
  49.     rightCaret                    = -1,                            /*Place caret for right block*/
  50.     hilite                        = 1,                            /*Direction is SysDirection*/
  51.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  52.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  53.     smHilite                    = 1,                            /*Direction is TESysJust - obsolete */
  54. /*Constants for styleRunPosition argument in PortionLine, DrawJustified,
  55.  MeasureJustified, CharToPixel, and PixelToChar.*/
  56.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  57.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  58.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  59.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this 
  60.  is neither the leftmost nor the rightmost. */
  61.     smOnlyStyleRun                = 0,                            /* obsolete */
  62.     smLeftStyleRun                = 1,                            /* obsolete */
  63.     smRightStyleRun                = 2,                            /* obsolete */
  64.     smMiddleStyleRun            = 3                                /* obsolete */
  65. };
  66.  
  67. /* type for styleRunPosition parameter in PixelToChar etc. */
  68. typedef short JustStyleCode;
  69.  
  70. typedef short FormatOrder[1];
  71.  
  72. typedef FormatOrder *FormatOrderPtr;
  73.  
  74. struct OffPair {
  75.     short                            offFirst;
  76.     short                            offSecond;
  77. };
  78. typedef struct OffPair OffPair;
  79.  
  80. typedef OffPair OffsetTable[3];
  81.  
  82. typedef pascal Boolean (*StyleRunDirectionProcPtr)(short styleRunIndex, void *dirParam);
  83.  
  84. #if GENERATINGCFM
  85. typedef UniversalProcPtr StyleRunDirectionUPP;
  86. #else
  87. typedef StyleRunDirectionProcPtr StyleRunDirectionUPP;
  88. #endif
  89.  
  90. enum {
  91.     uppStyleRunDirectionProcInfo = kPascalStackBased
  92.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  93.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  94.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  95. };
  96.  
  97. #if GENERATINGCFM
  98. #define NewStyleRunDirectionProc(userRoutine)        \
  99.         (StyleRunDirectionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  100. #else
  101. #define NewStyleRunDirectionProc(userRoutine)        \
  102.         ((StyleRunDirectionUPP) (userRoutine))
  103. #endif
  104.  
  105. #if GENERATINGCFM
  106. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)        \
  107.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  108. #else
  109. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)        \
  110.         (*(userRoutine))((styleRunIndex), (dirParam))
  111. #endif
  112.  
  113. extern pascal short Pixel2Char(Ptr textBuf, short textLen, short slop, short pixelWidth, Boolean *leadingEdge)
  114.  FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  115. extern pascal short Char2Pixel(Ptr textBuf, short textLen, short slop, short offset, short direction)
  116.  FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  117. extern pascal short PixelToChar(Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth, Boolean *leadingEdge, Fixed *widthRemaining, JustStyleCode styleRunPosition, Point numer, Point denom)
  118.  FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  119. extern pascal short CharToPixel(Ptr textBuf, long textLength, Fixed slop, long offset, short direction, JustStyleCode styleRunPosition, Point numer, Point denom)
  120.  FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  121. extern pascal void DrawJustified(Ptr textPtr, long textLength, Fixed slop, JustStyleCode styleRunPosition, Point numer, Point denom)
  122.  FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  123. extern pascal void MeasureJustified(Ptr textPtr, long textLength, Fixed slop, Ptr charLocs, JustStyleCode styleRunPosition, Point numer, Point denom)
  124.  FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  125. extern pascal Fixed PortionLine(Ptr textPtr, long textLen, JustStyleCode styleRunPosition, Point numer, Point denom)
  126.  FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  127. extern pascal void HiliteText(Ptr textPtr, short textLength, short firstOffset, short secondOffset, OffsetTable offsets)
  128.  FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  129. extern pascal void DrawJust(Ptr textPtr, short textLength, short slop)
  130.  FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  131. extern pascal void MeasureJust(Ptr textPtr, short textLength, short slop, Ptr charLocs)
  132.  FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  133. extern pascal Fixed PortionText(Ptr textPtr, long textLength)
  134.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  135. extern pascal long VisibleLength(Ptr textPtr, long textLength)
  136.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  137. extern pascal void GetFormatOrder(FormatOrderPtr ordering, short firstFormat, short lastFormat, Boolean lineRight, StyleRunDirectionUPP rlDirProc, Ptr dirParam)
  138.  FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  139. #if OLDROUTINENAMES
  140. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom)  \
  141.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining,  \
  142.     styleRunPosition, numer, denom)
  143. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)  \
  144.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition,  \
  145.     numer, denom)
  146. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom)  \
  147.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  148. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)  \
  149.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  150. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)  \
  151.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  152. #endif
  153. struct FontInfo {
  154.     short                            ascent;
  155.     short                            descent;
  156.     short                            widMax;
  157.     short                            leading;
  158. };
  159. typedef struct FontInfo FontInfo;
  160.  
  161. typedef short FormatStatus;
  162.  
  163. extern pascal void TextFont(short font)
  164.  ONEWORDINLINE(0xA887);
  165. extern pascal void TextFace(short face)
  166.  ONEWORDINLINE(0xA888);
  167. extern pascal void TextMode(short mode)
  168.  ONEWORDINLINE(0xA889);
  169. extern pascal void TextSize(short size)
  170.  ONEWORDINLINE(0xA88A);
  171. extern pascal void SpaceExtra(Fixed extra)
  172.  ONEWORDINLINE(0xA88E);
  173. extern pascal void DrawChar(short ch)
  174.  ONEWORDINLINE(0xA883);
  175. extern pascal void DrawString(ConstStr255Param s)
  176.  ONEWORDINLINE(0xA884);
  177. extern pascal void DrawText(const void *textBuf, short firstByte, short byteCount)
  178.  ONEWORDINLINE(0xA885);
  179. extern pascal short CharWidth(short ch)
  180.  ONEWORDINLINE(0xA88D);
  181. extern pascal short StringWidth(ConstStr255Param s)
  182.  ONEWORDINLINE(0xA88C);
  183. extern pascal short TextWidth(const void *textBuf, short firstByte, short byteCount)
  184.  ONEWORDINLINE(0xA886);
  185. extern pascal void MeasureText(short count, const void *textAddr, void *charLocs)
  186.  ONEWORDINLINE(0xA837);
  187. extern pascal void GetFontInfo(FontInfo *info)
  188.  ONEWORDINLINE(0xA88B);
  189. extern pascal void CharExtra(Fixed extra)
  190.  ONEWORDINLINE(0xAA23);
  191. extern pascal void StdText(short count, const void *textAddr, Point numer, Point denom)
  192.  ONEWORDINLINE(0xA882);
  193. extern pascal short StdTxMeas(short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info)
  194.  ONEWORDINLINE(0xA8ED);
  195. #if CGLUESUPPORTED
  196. extern void drawstring(const char *s);
  197. extern short stringwidth(const char *s);
  198. extern void stdtext(short count, const void *textAddr, const Point *numer, const Point *denom);
  199. #endif
  200.  
  201. #if PRAGMA_IMPORT_SUPPORTED
  202. #pragma import off
  203. #endif
  204.  
  205. #if PRAGMA_ALIGN_SUPPORTED
  206. #pragma options align=reset
  207. #endif
  208.  
  209. #ifdef __cplusplus
  210. }
  211. #endif
  212.  
  213. #endif /* __QUICKDRAWTEXT__ */
  214.